/**
 * Created by amy on 12/28/13.
 */

import java.io.Console;
import java.util.ArrayList;

public class Printer {
    String newLine = System.getProperty("line.separator");

    public static void main (String[] args){
//        Console console = System.console();
        Printer print = new Printer();
//        String input = console.readLine("Enter a number: ");
        String name = "amy";
        int n = 24;
        print.primeFactors(n);

    }

    public void star(int n){
        System.out.println('*');
    }

    public void line(int n) {
        for(int x = n; x > 0; x = x-1) {
            System.out.print('*');
        }
    }

    public void vLine(int n) {
        for(int x = n; x > 0; x = x-1) {
            System.out.println('*');
        }
    }

    public void rTriangle(int n) {
        for(int x = 1; n+1 > x  ; x = x+1) {
            String stars = starPrinter(x);
            System.out.println(stars);
        }
    }

    public void iTriangle(int n){
        Integer padding = n - 1;
        Integer star = 1;
        for(int x = 1; n+1 > x  ; x = x+1) {
            String pads = paddingPrinter(padding);
            String stars = starPrinter(star);
            System.out.println(pads+stars);
            star = star + 2;
            padding = padding - 1;
        }
    }

    public void diamondEnd(int n, int p){
        Integer star = (n * 2) - 3;
        Integer padding = p;
        for(int x = n-1; x > 0; x = x-1 ){
            String pads = paddingPrinter(padding);
            String stars = starPrinter(star);
            System.out.println(pads+stars );
            star = star - 2;
            padding = padding + 1;
        }
    }

    public void diamond(int n){
        this.iTriangle(n);
        this.diamondEnd(n, 1);
        }

    public void nameDiamond(int n, String name){
        this.iTriangle(n-1);
        System.out.println(name);
        this.diamondEnd(n, 0);
    }

//    creating strings
    public String starPrinter(int x){
        return repeater("*", x);
    }

    public String paddingPrinter(Integer p){
        return repeater(" ", p);
    }

    public String repeater(String s, int times){
        String charsMultiplied = "";
        for(int x = times; x > 0; x = x -1){
            charsMultiplied = charsMultiplied + s;
        }
        return charsMultiplied;
    }

    public void fizzBuzz(int n){
        for(int x = 1; x < n; x++ ){
            if(x % 3 == 0 && x % 5 == 0){
                System.out.println("FizzBuzz");
            }else if (x % 3 == 0){
                System.out.println("Fizz");
            }else if (x % 5 == 0){
                System.out.println("Buzz");
            } else{
                System.out.println(x);
            }
        }
    }

    public void primeFactors(int n){
       ArrayList<Integer> factors = new ArrayList<Integer>();
       while(n % 2 == 0){
           factors.add(2);
           n = n/2;
       }
       for(int i = 3; i < Math.sqrt(n); i = i+2)
            while (n%i == 0){
                factors.add(i);
                n = n % i;
            }
        if(n > 2){
            factors.add(n);
        }

       System.out.println(factors.toString());
    }
}
